package com.nondo.rdp.finance.service.impl;

import com.nondo.rdp.auth.endpoint.model.Query;
import com.nondo.rdp.core.model.View;
import com.nondo.rdp.finance.service.MarketService;

import feign.hystrix.FallbackFactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class MarketServiceHystric implements FallbackFactory<MarketService> {
    
	private static final Logger LOG = LoggerFactory.getLogger(MarketServiceHystric.class);

	@Override
	public MarketService create(Throwable e) {
		// TODO Auto-generated method stub
		return new MarketService() {
			
			/**
		     * 行情
		     */
		    @Override
		    public View<Map<String, Object>> marketIndex() {
		    	LOG.warn(e.getMessage(), e);
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View marketListUpdown(Map<String, Object> asharesBean) {
		    	LOG.warn(e.getMessage(), e);
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> marketInfo(Map<String, Object> marketBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> marketTrend(Map<String, Object> marketBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> marketKline(Map<String, Object> marketBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> marketReal(Map<String, Object> marketBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }
		    
		    @Override
		    public View marketConceptListUpdown(Map<String, Object> asharesBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    /**
		     * 模拟炒股
		     */
		    @Override
		    public View<Map<String, Object>> simulateIndex(Query<Map<String, Object>> query) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> simulateListbuy(Query<Map<String, Object>> query) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View simulateBuy(Map<String, Object> simulateBuyBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View simulateSale(Map<String, Object> simulateBuyBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> simulateLogListToday(Query<Map<String, Object>> query) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> simulateLogList(Query<Map<String, Object>> query) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View<Map<String, Object>> simulateGetOne(Map<String, Object> marketBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    /**
		     * 搜索
		     */
		    @Override
		    public View commonSearchKey(Map<String, Object> searchBean) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    /**
		     * 自选
		     */
		    @Override
		    public View<Map<String, Object>> chooseIndex(Query<Map<String, Object>> query) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View chooseAdd(Map<String, Object> stockChoose) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View chooseDelete(Map<String, Object> stockChoose) {
		        return View.ofError("操作失败，请稍候重试");
		    }

		    @Override
		    public View chooseCheck(Map<String, Object> stockChoose) {
		        return View.ofError("操作失败，请稍候重试");
		    }
		    
		};
	}
}
